package net.projecteuler.prob;

import net.projecteuler.util.FactorUtil;

public class Problem73 implements Runnable {

	@Override
	public void run() {
		int cnt = 0;
		for(int d = 4; d <= 12000; d++){
			int nMax = (int) Math.floor((double)d * 1.0 / 2.0);
			int nMin = (int) Math.ceil((double)d * 1.0 / 3.0);
			
			int[][] factors = FactorUtil.primeFactorization(d);
			
			int cntTemp = 0;
			for(int n = nMin; n <= nMax; n++){
				cntTemp++;
				for(int i = 0; i < factors.length; i++){
					if(n % factors[i][0] == 0){
						cntTemp--;
						break;
					}
				}
			}
			
			cnt += cntTemp;
			
			System.out.println("d=" + d + "(" + factors.length + " factors), n=" + nMin + "~" + nMax +" : " + cntTemp);
		}
		
		System.out.println(cnt);
	}

}
